home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
wwais103
/
sources.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
6KB
|
230 lines
VERSION 2.00
Begin Form sources_form
BackColor = &H00808080&
Caption = "WAIS Sources"
ClientHeight = 2985
ClientLeft = 1305
ClientTop = 3240
ClientWidth = 7365
Height = 3390
Left = 1245
LinkMode = 1 'Source
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2985
ScaleWidth = 7365
Top = 2895
Width = 7485
Begin CommandButton src_delete
Caption = "&Delete"
Height = 375
Left = 6360
TabIndex = 4
Top = 2520
Width = 855
End
Begin CommandButton src_change
Caption = "&Change"
Height = 375
Left = 5400
TabIndex = 5
Top = 2520
Width = 855
End
Begin CommandButton src_add
Caption = "&Add"
Height = 375
Left = 4440
TabIndex = 3
Top = 2520
Width = 855
End
Begin CommandButton add_ok
Caption = "&OK"
Height = 375
Left = 1080
TabIndex = 1
Top = 2520
Width = 855
End
Begin CommandButton src_use
Caption = "&Use"
Height = 375
Left = 120
TabIndex = 2
Top = 2520
Width = 855
End
Begin ListBox s_source_list
BackColor = &H00FFFFC0&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Terminal"
FontSize = 9
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 2190
Left = 120
TabIndex = 0
TabStop = 0 'False
Top = 240
Width = 7095
End
Begin Label Label1
BackColor = &H00808080&
Caption = "To revise sources"
Height = 375
Left = 3360
TabIndex = 6
Top = 2520
Width = 975
End
End
Sub add_ok_Click ()
mousepointer = HOURGLASS
s_source_list_dblclick
sources_form.Hide
End Sub
Sub Form_Load ()
z = DoEvents()
If sources_loaded Then
Exit Sub
End If
Open "wais.src" For Input As 2
x = 0
While Not EOF(2)
Line Input #2, source$
c = 1
While c <> 0
c = InStr(source$, Chr$(9))
If c > 0 Then
Mid$(source$, c, 1) = " "
End If
Wend
c1 = InStr(source$, " ")
s_database(x) = Mid$(source$, 1, c1 - 1)
c2 = InStr(c1 + 1, source$, " ")
s_port(x) = Val(Mid$(source$, c1 + 1, c2 - c1))
c3 = InStr(c2 + 1, source$, " ")
s_service(x) = Mid$(source$, c2 + 1, c3 - c2 - 1)
s_source_list.AddItem Right$(source$, Len(source$) - c3)
x = x + 1
Wend
Close (2)
sources_loaded = True
mousepointer = DEFAULT
End Sub
Sub Form_Paint ()
mousepointer = DEFAULT
End Sub
Sub s_source_list_dblclick ()
Dim x As Integer
Dim src As Integer
Dim ssrc As Integer
If s_source_list.listindex > -1 Then
src = question_form.source_list.listcount
ssrc = s_source_list.listindex
For x = 0 To src - 1
If src_port(x) = s_port(ssrc) And src_service(x) = s_service(ssrc) And src_database(x) = s_database(ssrc) Then
Exit Sub
End If
Next x
src_port(src) = s_port(ssrc)
src_service(src) = s_service(ssrc)
src_database(src) = s_database(ssrc)
question_form.source_list.AddItem s_source_list.text
End If
End Sub
Sub src_add_Click ()
new_src_form.Show 1
End Sub
Sub src_change_Click ()
src = s_source_list.listindex
If src = -1 Then
Exit Sub
End If
new_src_form.s_add_title.text = s_source_list.text
port$ = Str$(s_port(src))
new_src_form.s_add_port.text = Right$(port$, Len(port$) - 1)
new_src_form.s_add_server.text = s_service(src)
new_src_form.s_add_database.text = s_database(src)
new_src_form.Show 1
If s_change_accepted Then
For x = s_source_list.listindex To s_source_list.listcount
s_port(x) = s_port(x + 1)
s_service(x) = s_service(x + 1)
s_database(x) = s_database(x + 1)
Next x
s_source_list.RemoveItem s_source_list.listindex
End If
End Sub
Sub src_delete_Click ()
If s_source_list.listindex = -1 Then
MsgBox ("Please select a source to delete")
Exit Sub
End If
If MsgBox(" Are you sure?", 1) = 1 Then
For x = s_source_list.listindex To s_source_list.listcount
s_port(x) = s_port(x + 1)
s_service(x) = s_service(x + 1)
s_database(x) = s_database(x + 1)
Next x
s_source_list.RemoveItem s_source_list.listindex
End If
End Sub
Sub src_use_Click ()
s_source_list_dblclick
End Sub